/*
 * MyCamera.h
 *
 *  Created on: 15 Oct 2013
 *      Author: Patrick
 */

#ifndef MYCAMERA_H_
#define MYCAMERA_H_

#include <OgreCamera.h>
#include <OgreRenderWindow.h>
#include <OgreSceneManager.h>

#include "MyInputManager.h"

class MyCamera: public OIS::MouseListener, OIS::KeyListener {
public:
	MyCamera(Ogre::SceneManager* sceneMgr, Ogre::RenderWindow* renderWnd,
			MyInputManager* inptMgr);
	virtual ~MyCamera();

	void updateCamera(double timeSinceLastFrame);

private:
	bool mouseMoved(const OIS::MouseEvent &evt);
	bool mousePressed(const OIS::MouseEvent &evt, OIS::MouseButtonID id);
	bool mouseReleased(const OIS::MouseEvent &evt, OIS::MouseButtonID id);

	bool keyPressed(const OIS::KeyEvent &evt);
	bool keyReleased(const OIS::KeyEvent &evt);

	//pointer to the game-window
	Ogre::RenderWindow* renderWindow;

	//pointer to the game-scene manager
	Ogre::SceneManager* sceneManager;

	//camera
	Ogre::Camera* camera;

	//viewport
	Ogre::Viewport* viewport;

	//target node
	Ogre::Vector3 targetNodePosition;
	Ogre::Vector3 targetFrontDirection;
	Ogre::Vector3 targetSideDirection;
	Ogre::Vector3 targetUpDirection;

	//vector from target- to camera- node
	Ogre::Vector3 targetToCameraHorizontalDirection;
	Ogre::Vector3 targetToCameraVerticalDirection;
	float targetToCameraDistance;

	//movement speed values
	Ogre::Real moveSpeed;
	Ogre::Degree rotateSpeed;
	float moveScale;
	Ogre::Degree rotScale;

	//key booleans
	bool movingForward;
	bool movingBackwards;
	bool movingToTheLeft;
	bool movingToTheRight;
	bool turningToTheLeft;
	bool turningToTheRight;
	bool movingCamera;
	float scrolling;
};

#endif /* MYCAMERA_H_ */
